package api

import (
	"gateway-api/basic/config"
	__ "gateway-api/basic/proto"
	"gateway-api/handler/request"
	"github.com/gin-gonic/gin"
	"net/http"
)

func HospitalList(c *gin.Context) {
	var param request.HospitalList
	if err := c.ShouldBind(&param); err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 400,
			"mes":  "参数错误",
		})
		return
	}
	r, err := config.UserCline.HospitalList(c, &__.HospitalListReq{
		Page:     param.Page,
		PageSize: param.PageSize,
	})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 400,
			"mes":  err.Error(),
		})
		return
	}
	c.JSON(http.StatusOK, gin.H{
		"code": 200,
		"mes":  "医院展示成功",
		"data": r,
	})
	return
}
